<template>
	<div>
		<div class="crumbs">
            <el-breadcrumb separator="/">
                <el-breadcrumb-item>
                    <i class="el-icon-lx-calendar"></i> 表单
                </el-breadcrumb-item>
                <el-breadcrumb-item>申请项目</el-breadcrumb-item>
            </el-breadcrumb>
        </div>
		<div class="container">
            <div class="form-box">
                <el-form ref="form" label-width="100px">
                    <el-form-item label="项目名">
                        <el-input v-model="project.projectName"></el-input>
                    </el-form-item>
                    
                    
                    
                    <el-form-item label="项目金额">
                        <el-input v-model="project.projectMoney"></el-input>
                    </el-form-item>
                    
                    <el-form-item label="合作方式">
                        <el-select v-model="project.projectCooperate" placeholder="请选择">
                            <el-option v-for="item in cooperates" :key="item.value" :label="item.label" :value="item.value"></el-option>
                        </el-select>
                    </el-form-item>
                    
                    
                    
                    <el-form-item label="项目类型">
                        <el-select v-model="project.industryTypeId" placeholder="请选择">
                            <el-option v-for="item in industry" :key="item.industryId" :value="item.industryName"></el-option>
                        </el-select>
                    </el-form-item>
                    
					<el-form-item label="所属区县">
                        <el-select v-model="project.projectCountryId" placeholder="请选择">
                            <el-option v-for="item in country" :key="item.countryId" :value="item.countryName"></el-option>
                        </el-select>
                    </el-form-item>
					
					
						
                    <el-form-item label="简述项目内容">
                        <el-input type="textarea" rows="3" v-model="project.projectContent"></el-input>
                    </el-form-item>
                    
                    <el-form-item>
                        <el-button type="primary" @click="applicationProject">提交</el-button>
                        <el-button>取消</el-button>
                    </el-form-item>

                </el-form>
            </div>
        </div>
		
		
		
	</div>
</template>

<script>
	export default {
		data: function() {
			return {
				project:{
					projectStatus:"UN_ACCEPT",
					projectPhase:"1",
					projectResult:"",
					projectSxTotal:"7",
					projectFileAddr:"暂无",
					
					projectName:"",
					projectContent:"",
					
					industryTypeId:"",
					projectCountryId:"",
					projectTime:"",
					projectUpdateTime:"",
					projectUserId:"",
					/*项目合作方式*/
					projectCooperate:"",
					projectMoney:"",
				},
				/*产业类型数组*/
				industry:[],
				/*区县类型数组*/
				country:[],
				/*项目合作方式*/
				cooperates: [{
			          value: '独资',
			          label: '独资'
			        }, {
			          value: '合资',
			          label: '合资'
			        }, {
			          value: '合作',
			          label: '合作'
			        }],
				
			};
		},
		methods: {
			/*新增项目*/
			applicationProject(){
				for (let i = 0;i < this.industry.length;i ++) {
					if(this.industry[i].industryName == this.project.industryTypeId){
						this.project.industryTypeId = this.industry[i].industryId;
					}
				}
				for (let i = 0;i < this.country.length;i ++) {
					if(this.country[i].countryName == this.project.projectCountryId){
						this.project.projectCountryId = this.country[i].countryId;
					}
				}
				this.$axios.post("/user/applicationProject",this.project).then(resp => {
					if(resp.data.code == "0000"){
						alert("提交成功");
					}else{
						alert("提交失败");
					}
					console.log(resp);
                });
				
			},
			/*获取产业类型数组*/
			getAllIndustry(){
				this.$axios.post("/user/getAllIndustry").then(resp => {
					this.industry = resp.data.data;
                });
			},
			/*获取区县类型数组*/
			getAllCountry(){
				this.$axios.post("/user/getAllCountry").then(resp => {
					this.country = resp.data.data;
                });
			},
			
			
		},
		/*进来就会执行*/
		mounted() {
			this.getAllIndustry();
			this.getAllCountry();
		}
	};
</script>

<style scoped>
	
</style>